#include "NcDimWrapper.h"

namespace OCPP {
	NcDimWrapper::NcDimWrapper(String name)
		:_name(name)
	{

	}

	NcDimWrapper::NcDimWrapper(String name,FloatVector fv)
		:_name(name)
		,_fv(fv)
	{
	}

	const size_t NcDimWrapper::size()
	{
		return _fv.size();
	}

	float NcDimWrapper::getFloat(size_t i)
	{
		if (_fv.size() == 0)
		{
			return i;
		}
		return _fv[i];
	}

	int NcDimWrapper::getInt(size_t i)
	{
		if (_fv.size() == 0)
		{
			return i;
		}
		return (int)_fv[i];
	}

	String NcDimWrapper::getString(size_t i)
	{
		if (_fv.size() == 0)
		{
			return std::to_string(i);
		}
		return str_format("%.1f", _fv[i]);
	}
}


